package com.xinsilu.hospital.controller;


import com.xinsilu.common.Result;
import com.xinsilu.hospital.entity.DepartmentTable;
import com.xinsilu.hospital.entity.RegistrationTable;
import com.xinsilu.hospital.service.IRegistrationTableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;



import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ym
 * @since 2021-09-22
 */
@RestController
@RequestMapping("/api/hospital/registrationTable")
public class RegistrationTableController {

    @Autowired
    private IRegistrationTableService iRegistrationTableService;
    @RequestMapping("/insertregistration")
    public Object addgh(RegistrationTable registrationTable){

        boolean save = iRegistrationTableService.save(registrationTable);
        if(save){
            return Result.ok("成功");
        }
        return Result.ok(save);

    }

    @RequestMapping("/guahaolist")
    public  Object ghlist(){
        List<RegistrationTable> list = iRegistrationTableService.guahaoList();

        return Result.ok(list);

    }
    @RequestMapping("/chaxunlist")
    public  Object chaxunlist( RegistrationTable registrationTable){

        List<RegistrationTable> list = iRegistrationTableService.chaxunList(registrationTable);
        System.out.println(registrationTable);
        return Result.ok(list);

    }

    @RequestMapping("/chaxunid")
    public  Object chaxunid(RegistrationTable registrationTable){

        List<RegistrationTable> chaxunid = iRegistrationTableService.chaxunid(registrationTable);
        //System.out.println(chaxunid.get(0).getUserTable().getId());
        return Result.ok(chaxunid);

    }
}
